<?php
require './roteiroLitSistemas/conroteirolitecisistemas.php';
$query = "SELECT * FROM tbsistema";
$executa = mysql_query($query);
$a = mysql_query($query);
?>
<?php 
if(isset($_POST['enviar2'])){
 $sistema = $_POST['sistema'];
 $query2 = "SELECT * FROM tbperguntas WHERE idsistema= '".$sistema."'";
 $exec = mysql_query($query2);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Roteiro de Teste - Liteci </title>
</head>

<body>
 <form name="gestor" action="roteiroLitSistemas/gravar.php" method="post" enctype="multipart/form-data">
     <textarea name="pergunta" id="pergunta" cols="60" rows="10"></textarea>
 <select id="sistema" name="sistema">
 <?php while($prod = mysql_fetch_array($executa)) { ?>
 <option value="<?php echo $prod['id'] ?>"><?php echo $prod['descricao'] ?></option>
 <?php } ?> 
 </select> 
<input type="submit" name="enviar" id="enviar" value="Enviar" />
</form>
</br>
</br>
<form name="lista" action="" method="post" >
 <select id="sistema" name="sistema">
 <?php while($prod = mysql_fetch_array($a)) { ?>
 <option value="<?php echo $prod['id'] ?>"><?php echo $prod['descricao'] ?></option>
 <?php } ?> 
 </select> 
   <input type="submit" name="enviar2" id="enviar2" value="Listar" />
</form>
</br>
<ul>
    <?php while($prod = @mysql_fetch_array($exec)) { ?>
    <li><?php echo $prod['pergunta'] ?></li>
    <?php }?>
</ul>
</body>
</html>